package cn.xuanxuanyuhua.crm.util;


import cn.xuanxuanyuhua.crm.domain.Employee;
import org.apache.shiro.SecurityUtils;


public abstract class UserContext {

    public static Employee getActiveUser(){
        return (Employee)SecurityUtils.getSubject().getPrincipal();
    }
    public static boolean isAdminAndMgr(){
        Employee activeUser = getActiveUser();
        //只有主体才有授权信息
        if (activeUser.isAdmin() || SecurityUtils.getSubject().hasRole("客户经理")){
            return true;
        }
        return false;
    }

}
